package com.cloud.wms.ui.in.entity;

import android.os.Parcel;
import android.text.TextUtils;

import com.cloud.wms.ui.main.entity.CommodityEntity;

import java.util.List;

/**
 * @Author:Chen
 * @Date: 2021-01-25 16:21
 * @Description:
 */
public class InMarkCommodityEntity {

    /**
     * boxID : 41870601
     * boxCode : 1XM-0000101
     * detailist : [{"commodityId":329519501,"barCode":"ehz001","commodityCode":"ehz001","commodityCodeList":null,"commodityName":"二黑子","amount":1,"productBatchID":541601,"posID":0,"productBatchCode":"BH-21052410-0000001","posCode":null,"boxID":41870601,"boxCode":"1XM-0000101","productionDate":"2021-05-24 00:00:00","expirationDate":"2021-05-24 00:00:00","inDate":"2021-05-24 00:00:00"}]
     */

    private long boxID;
    private String boxCode;
    private List<CommodityBean> detailist;

    public long getBoxID() {
        return boxID;
    }

    public void setBoxID(long boxID) {
        this.boxID = boxID;
    }

    public String getBoxCode() {
        return boxCode;
    }

    public void setBoxCode(String boxCode) {
        this.boxCode = boxCode;
    }

    public List<CommodityBean> getDetailist() {
        return detailist;
    }

    public void setDetailist(List<CommodityBean> detailist) {
        this.detailist = detailist;
    }

    public static class CommodityBean extends CommodityEntity {
        private String UserName;
        private String ShelfTime;

        public String getNameAbbreviation() {
            if (TextUtils.isEmpty(getUserName())) return "";
            return getUserName().substring(0, 1);
        }

        public String getUserName() {
            return UserName;
        }

        public void setUserName(String userName) {
            UserName = userName;
        }

        public String getShelfTime() {
            return ShelfTime;
        }

        public void setShelfTime(String shelfTime) {
            ShelfTime = shelfTime;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            super.writeToParcel(dest, flags);
            dest.writeString(this.UserName);
            dest.writeString(this.ShelfTime);
        }

        public CommodityBean() {
        }

        protected CommodityBean(Parcel in) {
            super(in);
            this.UserName = in.readString();
            this.ShelfTime = in.readString();
        }

        public static final Creator<CommodityBean> CREATOR = new Creator<CommodityBean>() {
            @Override
            public CommodityBean createFromParcel(Parcel source) {
                return new CommodityBean(source);
            }

            @Override
            public CommodityBean[] newArray(int size) {
                return new CommodityBean[size];
            }
        };
    }
}
